home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 February: Tool Chest / Apple Developer CD Series Tool Chest February 1996 (Apple Computer)(1996).iso / Tool Chest / Development Tools & Languages / Macintosh Common Lisp Related / interfaces / PInterface Translator / PInterfaces / Events.p < prev    next >
Encoding:
Text File  |  1993-09-16  |  2.8 KB  |  138 lines  |  [TEXT/MPS ]

  1. {
  2. Created: Sunday, January 6, 1991 at 10:35 PM
  3.     Events.p
  4.     Pascal Interface to the Macintosh Libraries
  5.  
  6.         Copyright Apple Computer, Inc.    1985-1989
  7.         All rights reserved
  8.  
  9. }
  10.  
  11.  
  12. {$IFC UNDEFINED UsingIncludes}
  13. {$SETC UsingIncludes := 0}
  14. {$ENDC}
  15.  
  16. {$IFC NOT UsingIncludes}
  17.     UNIT Events;
  18.     INTERFACE
  19. {$ENDC}
  20.  
  21. {$IFC UNDEFINED UsingEvents}
  22. {$SETC UsingEvents := 1}
  23.  
  24. {$I+}
  25. {$SETC EventsIncludes := UsingIncludes}
  26. {$SETC UsingIncludes := 1}
  27. {$IFC UNDEFINED UsingTypes}
  28. {$I $$Shell(PInterfaces)Types.p}
  29. {$ENDC}
  30. {$IFC UNDEFINED UsingQuickdraw}
  31. {$I $$Shell(PInterfaces)Quickdraw.p}
  32. {$ENDC}
  33. {$SETC UsingIncludes := EventsIncludes}
  34.  
  35. CONST
  36. nullEvent = 0;
  37. mouseDown = 1;
  38. mouseUp = 2;
  39. keyDown = 3;
  40. keyUp = 4;
  41. autoKey = 5;
  42. updateEvt = 6;
  43. diskEvt = 7;
  44. activateEvt = 8;
  45. osEvt = 15;
  46.  
  47. { event mask equates }
  48. mDownMask = 2;
  49. mUpMask = 4;
  50. keyDownMask = 8;
  51. keyUpMask = 16;
  52. autoKeyMask = 32;
  53. updateMask = 64;
  54. diskMask = 128;
  55. activMask = 256;
  56. highLevelEventMask = 1024;
  57. osMask = -32768;
  58. everyEvent = -1;
  59.  
  60. { event message equates }
  61. charCodeMask = $000000FF;
  62. keyCodeMask = $0000FF00;
  63. adbAddrMask = $00FF0000;
  64. osEvtMessageMask = $FF000000;
  65.  
  66. { OSEvent Messages }
  67. mouseMovedMessage = $FA;
  68. suspendResumeMessage = $01;
  69. resumeFlag = 1;             { bit 0 of message indicates resume vs suspend }
  70. convertClipboardFlag = 2;   { bit 1 in resume message indicates clipboard change }
  71.  
  72. { modifiers }
  73. activeFlag = 1;             {bit 0 of modifiers for activate event}
  74. btnState = 128;             {Bit 7 of low byte is mouse button state}
  75. cmdKey = 256;               {Bit 0}
  76. shiftKey = 512;             {Bit 1}
  77. alphaLock = 1024;           {Bit 2 }
  78. optionKey = 2048;           {Bit 3 of high byte}
  79. controlKey = 4096;
  80.  
  81. { obsolete equates}
  82. networkEvt = 10;
  83. driverEvt = 11;
  84. app1Evt = 12;
  85. app2Evt = 13;
  86. app3Evt = 14;
  87. app4Evt = 15;
  88. networkMask = 1024;
  89. driverMask = 2048;
  90. app1Mask = 4096;
  91. app2Mask = 8192;
  92. app3Mask = 16384;
  93. app4Mask = -32768;
  94.  
  95. TYPE
  96. EventRecord = RECORD
  97.     what: INTEGER;
  98.     message: LONGINT;
  99.     when: LONGINT;
  100.     where: Point;
  101.     modifiers: INTEGER;
  102.     END;
  103.  
  104.  
  105. KeyMap = PACKED ARRAY [0..127] OF BOOLEAN;
  106.  
  107. FUNCTION GetNextEvent(eventMask: INTEGER;VAR theEvent: EventRecord): BOOLEAN;
  108.     INLINE $A970;
  109. FUNCTION WaitNextEvent(eventMask: INTEGER;VAR theEvent: EventRecord;sleep: LONGINT;
  110.     mouseRgn: RgnHandle): BOOLEAN;
  111.     INLINE $A860;
  112. FUNCTION EventAvail(eventMask: INTEGER;VAR theEvent: EventRecord): BOOLEAN;
  113.     INLINE $A971;
  114. PROCEDURE GetMouse(VAR mouseLoc: Point);
  115.     INLINE $A972;
  116. FUNCTION Button: BOOLEAN;
  117.     INLINE $A974;
  118. FUNCTION StillDown: BOOLEAN;
  119.     INLINE $A973;
  120. FUNCTION WaitMouseUp: BOOLEAN;
  121.     INLINE $A977;
  122. PROCEDURE GetKeys(VAR theKeys: KeyMap);
  123.     INLINE $A976;
  124. FUNCTION TickCount: LONGINT;
  125.     INLINE $A975;
  126. FUNCTION GetDblTime: LONGINT;
  127.     INLINE $2EB8,$02F0;
  128. FUNCTION GetCaretTime: LONGINT;
  129.     INLINE $2EB8,$02F4;
  130.  
  131.  
  132. {$ENDC}    { UsingEvents }
  133.  
  134. {$IFC NOT UsingIncludes}
  135.     END.
  136. {$ENDC}
  137.  
  138.